public class Position {

  /** create a position. 
   * @param r the Column
   * @param c the column
  */
  public Position(int c, int r) { 
    this.r = r; this.c = c; 
  }

  protected int r;
  protected int c;

  /** get the Column represented by this position.
   * @return the Column.
   */
  public int getColumn() { return c; }

  /** get the Row represented by this position.
   * @return the Row.
   */
  public int getRow() { return r; }

  public boolean equals(Object o) {
    if (o.getClass() != Position.class) { return false; }
    Position other = (Position) o;
    return r==other.r && c==other.c;
  }

  public int hashCode() {
    // works ok for positions up to colums == 479
    return 479*r+c;
  }
  
  public String toString() {
    return "{"+c+","+r+"}";
  }
}
